home *** CD-ROM | disk | FTP | other *** search
/ Stone Design / Stone Design.iso / Stone_Friends / Wave / WavesWorld / Source / Libraries / tcl7.4b3 / doc / tclsh.1 < prev    next >
Encoding:
Text File  |  1994-12-17  |  3.2 KB  |  91 lines

  1. '\"
  2. '\" Copyright (c) 1993 The Regents of the University of California.
  3. '\" Copyright (c) 1994 Sun Microsystems, Inc.
  4. '\"
  5. '\" See the file "license.terms" for information on usage and redistribution
  6. '\" of this file, and for a DISCLAIMER OF ALL WARRANTIES.
  7. '\" 
  8. '\" @(#) tclsh.1 1.5 94/12/17 16:18:57
  9. '/" 
  10. .so man.macros
  11. .HS tclsh tclcmds
  12. .BS
  13. '\" Note:  do not modify the .SH NAME line immediately below!
  14. .SH NAME
  15. tclsh \- Simple shell containing Tcl interpreter
  16. .SH SYNOPSIS
  17. \fBtclsh\fR ?\fIfileName arg arg ...\fR?\fR
  18. .BE
  19.  
  20. .SH DESCRIPTION
  21. .PP
  22. \fBTclsh\fR is a shell-like application that reads Tcl commands
  23. from its standard input or from a file and evaluates them.
  24. If invoked with no arguments then it runs interactively, reading
  25. Tcl commands from standard input and printing command results and
  26. error messages to standard output.
  27. It runs until the \fBexit\fR command is invoked or until it
  28. reaches end-of-file on its standard input.
  29. If there exists a file \fB.tclshrc\fR in the home directory of
  30. the user, \fBtclsh\fR evaluates the file as a Tcl script
  31. just before reading the first command from standard input.
  32.  
  33. .SH "SCRIPT FILES"
  34. .PP
  35. If \fBtclsh\fR is invoked with arguments then the first argument
  36. is the name of a script file and any additional arguments
  37. are made available to the script as variables (see below).
  38. Instead of reading commands from standard input \fBtclsh\fR will
  39. read Tcl commands from the named file;  \fBtclsh\fR will exit
  40. when it reaches the end of the file.
  41. There is no automatic evaluation of \fB.tclshrc\fR in this
  42. case, but the script file can always \fBsource\fR it if desired.
  43. .PP
  44. If you create a Tcl script in a file whose first line is
  45. .DS
  46. \fB#!/usr/local/bin/tclsh
  47. .DE
  48. then you can invoke the script file directly from your shell if
  49. you mark the file as executable.
  50. This assumes that \fBtclsh\fR has been installed in the default
  51. location in /usr/local/bin;  if it's installed somewhere else
  52. then you'll have to modify the above line to match.
  53.  
  54. .SH "VARIABLES"
  55. .PP
  56. \fBTclsh\fR sets the following Tcl variables:
  57. .TP 15
  58. \fBargc\fR
  59. Contains a count of the number of \fIarg\fR arguments (0 if none),
  60. not including the name of the script file.
  61. .TP 15
  62. \fBargv\fR
  63. Contains a Tcl list whose elements are the \fIarg\fR arguments,
  64. in order, or an empty string if there are no \fIarg\fR arguments.
  65. .TP 15
  66. \fBargv0\fR
  67. Contains \fIfileName\fR if it was specified.
  68. Otherwise, contains the name by which \fBtclsh\fR was invoked.
  69. .TP 15
  70. \fBtcl_interactive\fR
  71. Contains 1 if \fBtclsh\fR is running interactively (no
  72. \fIfileName\fR was specified and standard input is a terminal-like
  73. device), 0 otherwise.
  74. .LP
  75.  
  76. .SH PROMPTS
  77. .PP
  78. When \fBtclsh\fR is invoked interactively it normally prompts for each
  79. command with ``\fB% \fR''.  You can change the prompt by setting the
  80. variables \fBtcl_prompt1\fR and \fBtcl_prompt2\fR.  If variable
  81. \fBtcl_prompt1\fR exists then it must consist of a Tcl script
  82. to output a prompt;  instead of outputting a prompt \fBtclsh\fR
  83. will evaluate the script in \fBtcl_prompt1\fR.
  84. The variable \fBtcl_prompt2\fR is used in a similar way when
  85. a newline is typed but the current command isn't yet complete;
  86. if \fBtcl_prompt2\fR isn't set then no prompt is output for
  87. incomplete commands.
  88.  
  89. .SH KEYWORDS
  90. argument, interpreter, prompt, script file, shell
  91.